﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JXT.PrimaryKey.Batman.Collections;
using JXT.PrimaryKey.Batman.Core.Configuration;
using JXT.PrimaryKey.Batman.Domain.Services;
using JXT.PrimaryKey.Batman.Domain.Quotation.Models;
using JXT.PrimaryKey.Batman.Domain.Specifications;

namespace JXT.PrimaryKey.Batman.Domain.Quotation.Services
{
    public interface ITimeSharingQuoteService : ICachedService
    {
        ExchangeSettingConfigurationElementCollection ExchangeSetting { get; }

        void Append(TimeSharingQuote entity);

        /// <summary>
        /// 删除小于endTime的数据
        /// </summary>
        /// <param name="endTime">删除临界时间</param>
        void Delete(DateTime endTime);

        /// <summary>
        /// 对当日数据进行补充
        /// </summary>
        void Finish(string code, MarketType type);

        /// <summary>
        /// 根据相关条件获取分时数据
        /// </summary>
        /// <param name="code">股票代码</param>
        /// <param name="type">市场类型</param>
        /// <param name="time">时间</param>
        /// <returns>符合条件的分时数据</returns>
        TimeSharingQuote GetCacheSingle(string code, MarketType type = MarketType.Unknown, DateTime? time = null);

        /// <summary>
        /// 根据条件获取分时数据
        /// </summary>
        /// <param name="code">股票代码</param>
        /// <param name="type">市场类型</param>
        /// <returns>符合条件的分时数据</returns>
        TimeSharingQuote GetSingle(string code, MarketType type = MarketType.Unknown);

        /// <summary>
        /// 获取最新一条分时数据
        /// </summary>
        /// <param name="code">股票代码</param>
        /// <param name="type">市场类型</param>
        /// <returns>符合条件的分时数据</returns>
        TimeSharingQuote GetLastSingle(string code, MarketType type = MarketType.Unknown);

        /// <summary>
        /// 获取最后一个交易日的分时行情数据
        /// </summary>
        /// <param name="code">证券代码</param>
        /// <param name="type">交易所类型</param>
        /// <returns>实时交易数据</returns>
        IEnumerable<TimeSharingQuote> GetLastDailyList(string code, MarketType type = MarketType.Unknown);

        /// <summary>
        /// 获取某个时间段的分时数据集合
        /// </summary>
        /// <param name="code">股票代码</param>
        /// <param name="type">市场类型</param>
        /// <param name="startTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <returns>分时数据集合</returns>
        IEnumerable<TimeSharingQuote> GetList(string code, MarketType type = MarketType.Unknown, DateTime? startTime = null, DateTime? endTime = null);
    }
}
